package com.ipc.app.util.converter;

import com.ipc.app.dal.doObject.OrderDO;
import com.ipc.app.model.Information;
import com.ipc.app.model.Order;
import com.ipc.app.model.User;

/**
 * @author 雪
 * 
 */
public class OrderConverter {

	public static OrderDO orderCoreTODO(Order order) {
		OrderDO orderDO = new OrderDO();
		orderDO.setConsumerId(order.getUser().getUserId());
		orderDO.setInformationId(order.getInformation().getInformationId());
		orderDO.setOrderId(order.getOrderId());
		orderDO.setPayAmount(order.getPayAmount());
		orderDO.setStatus(order.getStatus());
		return orderDO;
	}

	public static Order orderDOTOCore(OrderDO orderDO) {
		Order order = new Order();
		order.setCreateTime(orderDO.getCreateTime());

		Information information = new Information();
		information.setInformationId(orderDO.getInformationId());
		order.setInformation(information);

		order.setModifyTime(orderDO.getModifyTime());
		order.setOrderId(orderDO.getOrderId());
		order.setPayAmount(orderDO.getPayAmount());
		order.setStatus(orderDO.getStatus());

		User user = new User();
		user.setUserId(orderDO.getConsumerId());
		order.setUser(user);
		return order;
	}
}
